import request from "../../utils/request";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    videoGroupList: [], // 导航标签数据
    navId:'', // 导航的标识
    videoList: [],  // 视频列表数据
    videoId: '', // 视频 id 标识
    videoUpdateTime: [],  // 记录 video 播放的时长
    isTriggered: false, // 标识下拉是否触发下拉刷新
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getVideoGroupListData();
  },

  // 获取导航数据
  async getVideoGroupListData() {
    let videoGroupListData = await request('video/group/list');
    this.setData({
      videoGroupList: videoGroupListData.data.slice(0, 14),
      navId: videoGroupListData.data[0].id
    })
    this.getVideoList(this.data.navId);
  },

  // 获取视频列表数据
  async getVideoList(navId) {
    let videoListData = await request('video/group', {id: navId});
    let index = 0;
    if (videoListData.code === 301) {
      wx.showToast({
        title: '请先进行登录',
        icon: 'none',
        success: () => {
          setTimeout(function () {
            // 跳转至登录页面
            wx.reLaunch({
              url: '/pages/login/login'
            })
          }, 1000)
        }
      })
      return;
    }
    let videoList = videoListData.datas.map(item => {
      item.id = index++;
      return item;
    })
    this.setData({
      videoList,
      // 关闭下拉刷新
      isTriggered: false
    })
    wx.hideLoading();
  },

  // 点击切换导航的回调
  changeNav(event) {
    // 通过 id 向 event 传参的时候，如果传的是 number,会自动转换成 string
    // console.log(event.currentTarget);
    let navId = event.currentTarget.id;
    // 通过 data-value 的形式传参时就不会自动转换类型
    // let navId = event.currentTarget.dataset.id;
    // console.log(navId)
    this.setData({
      navId: navId*1,
      videoList: []
    })
    // 显示“加载中”的提示框
    wx.showLoading({
      title: '加载中',
    })
    // 动态获取当前导航对应的视频数据
    this.getVideoList(this.data.navId);
  },

  // 点击时视频播放或继续播放的回调
  handlePlay(event) {
  /*
  * 问题：多个视频同时播放
  * 需求：
  *   1. 在点击播放当前视频时，找到上一个正在播放的视频
  *   2. 在播放新的视频之前，关闭上一个正在播放的视频
  * 关键点：
  *   1. 如何找到上一个视频的实例对象
  *   2. 如何确认点击播放的视频和正在播放的视频不是同一个视频
  * 单例模式：
  *   原理：需要创建多个对象的场景下，通过一个变量接收，
  *        通过逻辑顺序去控制，始终保持只有一个对象
  *   好处：节省内存空间
  * */
    let vid = event.currentTarget.id;
    // 关闭上一个播放的视频
    // this.vid !== vid && this.videoContext && this.videoContext.stop();
    // this.vid = vid;
    // 更新 data 中 videoId 的状态数据
    this.setData({
      videoId: vid
    })
    // 创建控制 vidoe标签的实例对象
    this.videoContext = wx.createVideoContext(vid);
    // 判断当前的视频之前是否播放过，若有记录，则跳转至指定的播放位置
    let {videoUpdateTime} = this.data;
    let videoItem = videoUpdateTime.find(item => item.vid === vid)
    if (videoItem) {
      this.videoContext.seek(videoItem.currentTime);
    }
    // this.videoContext.play();
  },

  // 监听视频播放进度的回调
  handleTimeUpdate(event) {
    let videoTimeObj = {vid: event.currentTarget.id,
      currentTime: event.detail.currentTime};
    let {videoUpdateTime} = this.data;
    /*
    * 思路：判断记录播放时长的 videoUpdateTime 数组中是否有当前视频的播放记录
    *   1. 如果有，在原有的播放记录中修改播放时间为当前的播放时间
    *   2. 如果没有，需要在数组中添加当前视频的播放对象
    * */
    let videoItem = videoUpdateTime.find(item => item.vid === videoTimeObj.vid);
    if (videoItem) {  // 记录已存在
      videoItem.currentTime = videoTimeObj.currentTime;
    } else {  // 记录不存在
      videoUpdateTime.push(videoTimeObj);
      }
  //   更新 videoUpdateTime 的状态
    this.setData({
      videoUpdateTime
    })
  },

  // 视频播放结束调用的回调
  handleEnded(event) {
    // 移除在记录播放时长的数组中的当前视频对象
    let {videoUpdateTime} = this.data;
    videoUpdateTime.splice(
      videoUpdateTime.findIndex(item => item.vid === event.currentTarget.vid),
      1
    );
    this.setData({
      videoUpdateTime
    })
  },

  // 自定义下拉刷新的回调（scroll-view）
  handleRefresher() {
    this.getVideoList(this.data.navId);
  },

  // 自定义上拉触底的回调（scroll-view）
  handleToLower() {
    // 数据分页：1.后端分页，2.前端分页
    console.log('发送请求，从前端获取更多的数据后，追加到视频列表的后方');
    console.log('网易云音乐暂时没有提供分页的api');
    // 模拟数据
    let newVideoList = [ {
      "type": 1,
      "displayed": false,
      "alg": "onlineHotGroup",
      "extAlg": null,
      "data": {
        "alg": "onlineHotGroup",
        "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
        "threadId": "R_VI_62_F9569B95FDC52CC2F36520D1205F93DD",
        "coverUrl": "https://p1.music.126.net/z5jd7uOqHjZBGlP9VdIQrA==/109951163574225359.jpg",
        "height": 720,
        "width": 1280,
        "title": "超炸忍电Purple Dragons(VIp)夜猫必备神曲!",
        "description": null,
        "commentCount": 39,
        "shareCount": 98,
        "resolutions": [
          {
            "resolution": 240,
            "size": 16026530
          },
          {
            "resolution": 480,
            "size": 28064419
          },
          {
            "resolution": 720,
            "size": 43495860
          }
        ],
        "creator": {
          "defaultAvatar": false,
          "province": 440000,
          "authStatus": 1,
          "followed": false,
          "avatarUrl": "http://p1.music.126.net/dFYj3xDCiy630pOlUbpzkg==/109951165823048667.jpg",
          "accountStatus": 0,
          "gender": 1,
          "city": 445200,
          "birthday": 847900800000,
          "userId": 416954574,
          "userType": 4,
          "nickname": "爱音乐的郑小天",
          "signature": "音乐制作人，DJ/纯电子音乐 邮箱：975586071@qq.com 希望我的音乐可以治愈你们每个人. 爱音乐，爱生活，多多支持！",
          "description": "",
          "detailDescription": "",
          "avatarImgId": 109951165823048670,
          "backgroundImgId": 109951166218854640,
          "backgroundUrl": "http://p1.music.126.net/YqmSw__tO5jV6z6qJFVkSg==/109951166218854640.jpg",
          "authority": 0,
          "mutual": false,
          "expertTags": null,
          "experts": {
            "2": "音乐图文达人"
          },
          "djStatus": 10,
          "vipType": 11,
          "remarkName": null,
          "avatarImgIdStr": "109951165823048667",
          "backgroundImgIdStr": "109951166218854640"
        },
        "urlInfo": {
          "id": "F9569B95FDC52CC2F36520D1205F93DD",
          "url": "http://vodkgeyttp9.vod.126.net/cloudmusic/qnkBykJW_1914407470_shd.mp4?ts=1628935557&rid=D67FB5953E5A5B21595C5F89FE5AF163&rl=3&rs=pWUESslXKvGalMdqMmjMVrQiftctekRm&sign=c65179db3c8ef6a384b2db70991d2622&ext=hKu0ESUsHZMwowQ2cE6wC1HMK6%2FNRPyYs%2FAQpiiyzfdSoYYtV2jo%2BDDzWrxmA9xIvfX%2F5xTtldF5f4My1pm3uydmglHHjAFXj5V9UOegGrFBnSGi%2Bfq6mmrWQ%2Fz86vpo6oxIP9sobLaHvxZvCQNqqR%2FM0MhjkSS8vXXRdnlrc%2Fstn%2F1UogOysDoSF4ZVRtdGnhuUu1lQCLhHCKGI7J7a4rOFcvZ8HLM3h160nSrkLhi%2BaZ1TlRoX1MMF2vWzhb7B",
          "size": 43495860,
          "validityTime": 1200,
          "needPay": false,
          "payInfo": null,
          "r": 720
        },
        "videoGroup": [
          {
            "id": 1105,
            "name": "最佳饭制",
            "alg": null
          },
          {
            "id": 9104,
            "name": "电子",
            "alg": null
          },
          {
            "id": 4104,
            "name": "电音",
            "alg": null
          },
          {
            "id": 5100,
            "name": "音乐",
            "alg": null
          },
          {
            "id": 15241,
            "name": "饭制",
            "alg": null
          },
          {
            "id": 23116,
            "name": "音乐推荐",
            "alg": null
          },
          {
            "id": 16142,
            "name": "日语音乐",
            "alg": null
          }
        ],
        "previewUrl": null,
        "previewDurationms": 0,
        "hasRelatedGameAd": false,
        "markTypes": null,
        "relateSong": [
          {
            "name": "Purple Dragons (Dragons VIP)",
            "id": 526099041,
            "pst": 0,
            "t": 0,
            "ar": [
              {
                "id": 813244,
                "name": "Virtual Riot",
                "tns": [],
                "alias": []
              }
            ],
            "alia": [],
            "pop": 100,
            "st": 0,
            "rt": null,
            "fee": 0,
            "v": 12,
            "crbt": null,
            "cf": "",
            "al": {
              "id": 37027373,
              "name": "Purple Dragons (Dragons VIP)",
              "picUrl": "http://p4.music.126.net/UswIZ0GnLdO2xWtyEbIr0Q==/109951163093252046.jpg",
              "tns": [],
              "pic_str": "109951163093252046",
              "pic": 109951163093252050
            },
            "dt": 184058,
            "h": {
              "br": 320000,
              "fid": 0,
              "size": 7364485,
              "vd": -22100
            },
            "m": {
              "br": 192000,
              "fid": 0,
              "size": 4418708,
              "vd": -18600
            },
            "l": {
              "br": 128000,
              "fid": 0,
              "size": 2945820,
              "vd": -15500
            },
            "a": null,
            "cd": "01",
            "no": 1,
            "rtUrl": null,
            "ftype": 0,
            "rtUrls": [],
            "djId": 0,
            "copyright": 0,
            "s_id": 0,
            "mst": 9,
            "cp": 0,
            "mv": 0,
            "rtype": 0,
            "rurl": null,
            "publishTime": 1513958400007,
            "privilege": {
              "id": 526099041,
              "fee": 0,
              "payed": 0,
              "st": 0,
              "pl": 320000,
              "dl": 320000,
              "sp": 7,
              "cp": 1,
              "subp": 1,
              "cs": false,
              "maxbr": 320000,
              "fl": 320000,
              "toast": false,
              "flag": 128,
              "preSell": false
            }
          }
        ],
        "relatedInfo": null,
        "videoUserLiveInfo": null,
        "vid": "F9569B95FDC52CC2F36520D1205F93DD",
        "durationms": 181000,
        "playTime": 131712,
        "praisedCount": 479,
        "praised": false,
        "subscribed": false
      }
    },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_0161AFE17864C02777BED9AD715B2187",
          "coverUrl": "https://p2.music.126.net/xkyV6PHylVtALdaUIfFuOg==/109951163573033214.jpg",
          "height": 720,
          "width": 1280,
          "title": "20分钟看完ISY三亚国际音乐节上各大DJ的出场",
          "description": "20分钟看完ISY三亚国际音乐节上各大DJ的出场（Hardwell、R3hab、Dimitri Vegas & Like Mike、Quintino、Afrojack、Tiesto、Martin Garrix）",
          "commentCount": 205,
          "shareCount": 236,
          "resolutions": [
            {
              "resolution": 240,
              "size": 100991122
            },
            {
              "resolution": 720,
              "size": 468719217
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 1000000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/REl7peUGPv5dCDUM6BRxPw==/109951164701103068.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 1003000,
            "birthday": 832003200000,
            "userId": 298793301,
            "userType": 204,
            "nickname": "MartinGarrixWorld",
            "signature": "随缘更新",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951164701103070,
            "backgroundImgId": 109951163525071420,
            "backgroundUrl": "http://p1.music.126.net/TSwRcqIvKvD2EAadJUTR1w==/109951163525071431.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": {
              "1": "音乐视频达人",
              "2": "音乐图文达人"
            },
            "djStatus": 10,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951164701103068",
            "backgroundImgIdStr": "109951163525071431"
          },
          "urlInfo": {
            "id": "0161AFE17864C02777BED9AD715B2187",
            "url": "http://vodkgeyttp9.vod.126.net/cloudmusic/e7dfea4e52850690065d64c0b18ec061.mp4?ts=1628935557&rid=D67FB5953E5A5B21595C5F89FE5AF163&rl=3&rs=QRZTfXzepxjMqETdLpijJsEHqgKVSyUL&sign=797dc4a04985500468d673a648530b69&ext=hKu0ESUsHZMwowQ2cE6wC1HMK6%2FNRPyYs%2FAQpiiyzfdSoYYtV2jo%2BDDzWrxmA9xIvfX%2F5xTtldF5f4My1pm3uydmglHHjAFXj5V9UOegGrFBnSGi%2Bfq6mmrWQ%2Fz86vpo6oxIP9sobLaHvxZvCQNqqR%2FM0MhjkSS8vXXRdnlrc%2Fstn%2F1UogOysDoSF4ZVRtdGnhuUu1lQCLhHCKGI7J7a4rOFcvZ8HLM3h160nSrkLhjdIqAcfbbSZnMDrFynpsqf",
            "size": 468719217,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 720
          },
          "videoGroup": [
            {
              "id": 58100,
              "name": "现场",
              "alg": null
            },
            {
              "id": 1100,
              "name": "音乐现场",
              "alg": null
            },
            {
              "id": 9104,
              "name": "电子",
              "alg": null
            },
            {
              "id": 4104,
              "name": "电音",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 13184,
              "name": "Martin Garrix",
              "alg": null
            },
            {
              "id": 14146,
              "name": "兴奋",
              "alg": null
            },
            {
              "id": 16131,
              "name": "英文",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "0161AFE17864C02777BED9AD715B2187",
          "durationms": 1199830,
          "playTime": 145524,
          "praisedCount": 745,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_5DA5B896F72FD0D6A643E723D77DA4C6",
          "coverUrl": "https://p1.music.126.net/vZy587_W-oz2PoGiackvmQ==/109951163766420173.jpg",
          "height": 720,
          "width": 1632,
          "title": "Furkan Soysal ft Sözer Sepetci - Low Station",
          "description": "Furkan Soysal ft Sözer Sepetci - Low Station",
          "commentCount": 10,
          "shareCount": 486,
          "resolutions": [
            {
              "resolution": 240,
              "size": 18954656
            },
            {
              "resolution": 480,
              "size": 31939144
            },
            {
              "resolution": 720,
              "size": 39401539
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 650000,
            "authStatus": 1,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/QzIquOHkx5H5jJkam4JeWQ==/109951166217631866.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 653000,
            "birthday": 891792000000,
            "userId": 111259490,
            "userType": 4,
            "nickname": "uRRa",
            "signature": "üç günlük dünya🪐",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951166217631870,
            "backgroundImgId": 109951164996625360,
            "backgroundUrl": "http://p1.music.126.net/2iHgy7mewFmPCrhG1ErQqA==/109951164996625356.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": {
              "1": "影视视频达人"
            },
            "djStatus": 10,
            "vipType": 11,
            "remarkName": null,
            "avatarImgIdStr": "109951166217631866",
            "backgroundImgIdStr": "109951164996625356"
          },
          "urlInfo": {
            "id": "5DA5B896F72FD0D6A643E723D77DA4C6",
            "url": "http://vodkgeyttp9.vod.126.net/cloudmusic/OaAJeIQj_2230234657_shd.mp4?ts=1628935557&rid=D67FB5953E5A5B21595C5F89FE5AF163&rl=3&rs=POunoUpJkIOTyrKjxOchmbBTSsHoJJIS&sign=352bddc0df92a1cd4a9a35f9806e5034&ext=hKu0ESUsHZMwowQ2cE6wC1HMK6%2FNRPyYs%2FAQpiiyzfdSoYYtV2jo%2BDDzWrxmA9xIvfX%2F5xTtldF5f4My1pm3uydmglHHjAFXj5V9UOegGrFBnSGi%2Bfq6mmrWQ%2Fz86vpo6oxIP9sobLaHvxZvCQNqqR%2FM0MhjkSS8vXXRdnlrc%2Fstn%2F1UogOysDoSF4ZVRtdGnhuUu1lQCLhHCKGI7J7a4rOFcvZ8HLM3h160nSrkLhi%2BaZ1TlRoX1MMF2vWzhb7B",
            "size": 39401539,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 720
          },
          "videoGroup": [
            {
              "id": 1000,
              "name": "MV",
              "alg": null
            },
            {
              "id": 9104,
              "name": "电子",
              "alg": null
            },
            {
              "id": 4104,
              "name": "电音",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 3102,
              "name": "二次元",
              "alg": null
            },
            {
              "id": 14176,
              "name": "体育",
              "alg": null
            },
            {
              "id": 14212,
              "name": "欧美音乐",
              "alg": null
            },
            {
              "id": 23116,
              "name": "音乐推荐",
              "alg": null
            },
            {
              "id": 72116,
              "name": "短片",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "5DA5B896F72FD0D6A643E723D77DA4C6",
          "durationms": 184853,
          "playTime": 92703,
          "praisedCount": 335,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_A55A3A3BB6AA49813C37849B561A3C6E",
          "coverUrl": "https://p1.music.126.net/jUX3E0maEMZOsxLdORUjPA==/109951164149367199.jpg",
          "height": 1080,
          "width": 1920,
          "title": "Pete Bellis Tommy - Missing The Way (Original Mix)",
          "description": "Pete Bellis  Tommy - Missing The Way (Original Mix)",
          "commentCount": 80,
          "shareCount": 277,
          "resolutions": [
            {
              "resolution": 240,
              "size": 33786134
            },
            {
              "resolution": 480,
              "size": 58829300
            },
            {
              "resolution": 720,
              "size": 98675660
            },
            {
              "resolution": 1080,
              "size": 155945728
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 530000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/XVeqOMXiNjhs4sNCsqf46A==/109951165831287594.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 532500,
            "birthday": 791740800000,
            "userId": 46972908,
            "userType": 0,
            "nickname": "迪普希蒽-",
            "signature": "“希望有人懂我，即使我什么都不说”孔群7-9-1-8-7-9-0-3-4",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951165831287600,
            "backgroundImgId": 109951166110795100,
            "backgroundUrl": "http://p1.music.126.net/_L7bi5MKf1z9eBnocEPGng==/109951166110795099.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 0,
            "vipType": 11,
            "remarkName": null,
            "avatarImgIdStr": "109951165831287594",
            "backgroundImgIdStr": "109951166110795099"
          },
          "urlInfo": {
            "id": "A55A3A3BB6AA49813C37849B561A3C6E",
            "url": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/YnMPjyfy_2549200621_uhd.mp4?ts=1628935557&rid=D67FB5953E5A5B21595C5F89FE5AF163&rl=3&rs=YXqlhzLbGkCEwMtRNUwkDbrqfBrcxYWE&sign=f9339ebec2b89788448db2a894342b13&ext=hKu0ESUsHZMwowQ2cE6wC1HMK6%2FNRPyYs%2FAQpiiyzfdSoYYtV2jo%2BDDzWrxmA9xIvfX%2F5xTtldF5f4My1pm3uydmglHHjAFXj5V9UOegGrFBnSGi%2Bfq6mmrWQ%2Fz86vpo6oxIP9sobLaHvxZvCQNqqR%2FM0MhjkSS8vXXRdnlrc%2Fstn%2F1UogOysDoSF4ZVRtdGnhuUu1lQCLhHCKGI7J7a4rOFcvZ8HLM3h160nSrkLhi%2BaZ1TlRoX1MMF2vWzhb7B",
            "size": 155945728,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 1080
          },
          "videoGroup": [
            {
              "id": 1000,
              "name": "MV",
              "alg": null
            },
            {
              "id": 9104,
              "name": "电子",
              "alg": null
            },
            {
              "id": 4104,
              "name": "电音",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 14212,
              "name": "欧美音乐",
              "alg": null
            },
            {
              "id": 23116,
              "name": "音乐推荐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "A55A3A3BB6AA49813C37849B561A3C6E",
          "durationms": 266984,
          "playTime": 335282,
          "praisedCount": 868,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_E142EFBFF041A73026BA6E32652FBC48",
          "coverUrl": "https://p1.music.126.net/H4huzhdGPtBY4gpN2XSbWQ==/109951164889709921.jpg",
          "height": 720,
          "width": 1280,
          "title": "黄静美 怎么做怎么过怎么活 ProgHouse Mix 国语女",
          "description": "",
          "commentCount": 14,
          "shareCount": 75,
          "resolutions": [
            {
              "resolution": 240,
              "size": 37859054
            },
            {
              "resolution": 480,
              "size": 72162698
            },
            {
              "resolution": 720,
              "size": 86498734
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 350000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/-b4wM7YKwG7cyZIM3pLdEQ==/109951164873149479.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 350100,
            "birthday": -2209017600000,
            "userId": 2139099400,
            "userType": 0,
            "nickname": "新余DJ小伟",
            "signature": "",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951164873149470,
            "backgroundImgId": 109951164886398140,
            "backgroundUrl": "http://p1.music.126.net/dk4ZWPghtgCPw7-JbSgxlw==/109951164886398149.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 10,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951164873149479",
            "backgroundImgIdStr": "109951164886398149"
          },
          "urlInfo": {
            "id": "E142EFBFF041A73026BA6E32652FBC48",
            "url": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/Vr86hcch_2960898748_shd.mp4?ts=1628935557&rid=D67FB5953E5A5B21595C5F89FE5AF163&rl=3&rs=csyUwkiCkfqcwZrOqbfGnDscQZIFZisc&sign=50d9fe991588af01147f6f046cdd5a15&ext=hKu0ESUsHZMwowQ2cE6wC1HMK6%2FNRPyYs%2FAQpiiyzfdSoYYtV2jo%2BDDzWrxmA9xIvfX%2F5xTtldF5f4My1pm3uydmglHHjAFXj5V9UOegGrFBnSGi%2Bfq6mmrWQ%2Fz86vpo6oxIP9sobLaHvxZvCQNqqR%2FM0MhjkSS8vXXRdnlrc%2Fstn%2F1UogOysDoSF4ZVRtdGnhuUu1lQCLhHCKGI7J7a4rOFcvZ8HLM3h160nSrkLhi%2BaZ1TlRoX1MMF2vWzhb7B",
            "size": 86498734,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 720
          },
          "videoGroup": [
            {
              "id": 9104,
              "name": "电子",
              "alg": null
            },
            {
              "id": 4104,
              "name": "电音",
              "alg": null
            },
            {
              "id": 3107,
              "name": "混剪",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 23111,
              "name": "歌曲remix",
              "alg": null
            },
            {
              "id": 23116,
              "name": "音乐推荐",
              "alg": null
            },
            {
              "id": 15102,
              "name": "华语音乐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [
            {
              "name": "怎么做怎么过怎么活 (DJ.House咚鼓版)",
              "id": 1433498790,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 31891427,
                  "name": "黄静美",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 100,
              "st": 0,
              "rt": "",
              "fee": 8,
              "v": 6,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 86628033,
                "name": "怎么做怎么过怎么活",
                "picUrl": "http://p3.music.126.net/N32_UOoqtrcjTGjPI1TUOg==/109951164817875660.jpg",
                "tns": [],
                "pic_str": "109951164817875660",
                "pic": 109951164817875660
              },
              "dt": 219433,
              "h": {
                "br": 320000,
                "fid": 0,
                "size": 8780321,
                "vd": -68603
              },
              "m": {
                "br": 192000,
                "fid": 0,
                "size": 5268210,
                "vd": -66137
              },
              "l": {
                "br": 128000,
                "fid": 0,
                "size": 3512155,
                "vd": -64544
              },
              "a": null,
              "cd": "01",
              "no": 2,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 0,
              "s_id": 0,
              "mst": 9,
              "cp": 1416783,
              "mv": 0,
              "rtype": 0,
              "rurl": null,
              "publishTime": 0,
              "privilege": {
                "id": 1433498790,
                "fee": 8,
                "payed": 0,
                "st": 0,
                "pl": 128000,
                "dl": 0,
                "sp": 7,
                "cp": 1,
                "subp": 1,
                "cs": false,
                "maxbr": 999000,
                "fl": 128000,
                "toast": false,
                "flag": 0,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "E142EFBFF041A73026BA6E32652FBC48",
          "durationms": 320690,
          "playTime": 94185,
          "praisedCount": 370,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_5896985FF8255FA50F228D710D2E0F7F",
          "coverUrl": "https://p1.music.126.net/pdMibETzabMhYXO2HhZJRA==/109951164951246630.jpg",
          "height": 720,
          "width": 1280,
          "title": "非常震撼的一首电音《Fiery Sky》戴上耳机音量调最大",
          "description": null,
          "commentCount": 55,
          "shareCount": 221,
          "resolutions": [
            {
              "resolution": 240,
              "size": 18002412
            },
            {
              "resolution": 480,
              "size": 29103301
            },
            {
              "resolution": 720,
              "size": 35475034
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 310000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/TZ-cBMIVB9ENjBb69o3PQA==/109951165620713670.jpg",
            "accountStatus": 0,
            "gender": 2,
            "city": 310101,
            "birthday": -2209017600000,
            "userId": 2000419989,
            "userType": 0,
            "nickname": "阿姨-三",
            "signature": "2020新的一年，重新开始",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951165620713660,
            "backgroundImgId": 109951165478269300,
            "backgroundUrl": "http://p1.music.126.net/PRBocsJn2Xl2M7hZzVWyWw==/109951165478269295.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 0,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951165620713670",
            "backgroundImgIdStr": "109951165478269295"
          },
          "urlInfo": {
            "id": "5896985FF8255FA50F228D710D2E0F7F",
            "url": "http://vodkgeyttp9.vod.126.net/cloudmusic/TaRy1vuZ_2986152734_shd.mp4?ts=1628935557&rid=D67FB5953E5A5B21595C5F89FE5AF163&rl=3&rs=jJfLBfNhjfqXOAfRAFIeORJqMMtdiTIm&sign=f9c160e09c249dbed28de133aa82af7b&ext=hKu0ESUsHZMwowQ2cE6wC1HMK6%2FNRPyYs%2FAQpiiyzfdSoYYtV2jo%2BDDzWrxmA9xIvfX%2F5xTtldF5f4My1pm3uydmglHHjAFXj5V9UOegGrFBnSGi%2Bfq6mmrWQ%2Fz86vpo6oxIP9sobLaHvxZvCQNqqR%2FM0MhjkSS8vXXRdnlrc%2Fstn%2F1UogOysDoSF4ZVRtdGnhuUu1lQCLhHCKGI7J7a4rOFcvZ8HLM3h160nSrkLhi%2BaZ1TlRoX1MMF2vWzhb7B",
            "size": 35475034,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 720
          },
          "videoGroup": [
            {
              "id": 1000,
              "name": "MV",
              "alg": null
            },
            {
              "id": 9104,
              "name": "电子",
              "alg": null
            },
            {
              "id": 4104,
              "name": "电音",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 14212,
              "name": "欧美音乐",
              "alg": null
            },
            {
              "id": 23116,
              "name": "音乐推荐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [
            {
              "name": "Fiery Sky",
              "id": 1325896666,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 13042433,
                  "name": "Jarico",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 100,
              "st": 0,
              "rt": null,
              "fee": 0,
              "v": 3,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 74268209,
                "name": "Fiery Sky",
                "picUrl": "http://p3.music.126.net/YTgFICsNnx6pneo74KgkPg==/109951163683611891.jpg",
                "tns": [],
                "pic_str": "109951163683611891",
                "pic": 109951163683611890
              },
              "dt": 213864,
              "h": {
                "br": 320000,
                "fid": 0,
                "size": 8556713,
                "vd": -2
              },
              "m": {
                "br": 192000,
                "fid": 0,
                "size": 5134045,
                "vd": -2
              },
              "l": {
                "br": 128000,
                "fid": 0,
                "size": 3422711,
                "vd": -2
              },
              "a": null,
              "cd": "1",
              "no": 1,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 0,
              "s_id": 0,
              "mst": 9,
              "cp": 0,
              "mv": 0,
              "rtype": 0,
              "rurl": null,
              "publishTime": 1542556800007,
              "privilege": {
                "id": 1325896666,
                "fee": 0,
                "payed": 0,
                "st": 0,
                "pl": 320000,
                "dl": 320000,
                "sp": 7,
                "cp": 1,
                "subp": 1,
                "cs": false,
                "maxbr": 320000,
                "fl": 320000,
                "toast": false,
                "flag": 128,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "5896985FF8255FA50F228D710D2E0F7F",
          "durationms": 214205,
          "playTime": 105772,
          "praisedCount": 743,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_70ADED88EFE262E8A402E1D95316438B",
          "coverUrl": "https://p1.music.126.net/QnRSThbnrXTNb1h0DH73sQ==/109951164996269962.jpg",
          "height": 1080,
          "width": 1920,
          "title": "全球顶级电音move your body，带你重新找回抖腿的感觉，简直太嗨",
          "description": "",
          "commentCount": 1,
          "shareCount": 3,
          "resolutions": [
            {
              "resolution": 240,
              "size": 28842979
            },
            {
              "resolution": 480,
              "size": 48177608
            },
            {
              "resolution": 720,
              "size": 69355052
            },
            {
              "resolution": 1080,
              "size": 118360248
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 330000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/fMmlolYIns4pROtu6OAGvQ==/109951166188784479.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 330500,
            "birthday": 653587200000,
            "userId": 1881923259,
            "userType": 204,
            "nickname": "音乐老鸭煲",
            "signature": "盘点全球号挺音乐，用音乐聆听彼此",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951166188784480,
            "backgroundImgId": 109951165512897460,
            "backgroundUrl": "http://p1.music.126.net/6V1PQYM3gXvoj5apHYBeQA==/109951165512897460.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 0,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951166188784479",
            "backgroundImgIdStr": "109951165512897460"
          },
          "urlInfo": {
            "id": "70ADED88EFE262E8A402E1D95316438B",
            "url": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/gU41v5dy_3000689514_uhd.mp4?ts=1628935557&rid=D67FB5953E5A5B21595C5F89FE5AF163&rl=3&rs=jKtceTjcWiuIuAsTWkVtRDeJKFjkyICl&sign=eb3eb6f87f3640e18de0113cbf7be1f1&ext=hKu0ESUsHZMwowQ2cE6wC1HMK6%2FNRPyYs%2FAQpiiyzfdSoYYtV2jo%2BDDzWrxmA9xIvfX%2F5xTtldF5f4My1pm3uydmglHHjAFXj5V9UOegGrFBnSGi%2Bfq6mmrWQ%2Fz86vpo6oxIP9sobLaHvxZvCQNqqR%2FM0MhjkSS8vXXRdnlrc%2Fstn%2F1UogOysDoSF4ZVRtdGnhuUu1lQCLhHCKGI7J7a4rOFcvZ8HLM3h160nSrkLhi%2BaZ1TlRoX1MMF2vWzhb7B",
            "size": 118360248,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 1080
          },
          "videoGroup": [
            {
              "id": 9104,
              "name": "电子",
              "alg": null
            },
            {
              "id": 4104,
              "name": "电音",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 14212,
              "name": "欧美音乐",
              "alg": null
            },
            {
              "id": 23116,
              "name": "音乐推荐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [
            {
              "name": "Move Your Body",
              "id": 401382522,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 74625,
                  "name": "Sia",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 100,
              "st": 0,
              "rt": null,
              "fee": 8,
              "v": 22,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 3394107,
                "name": "This Is Acting",
                "picUrl": "http://p4.music.126.net/zmDE8IMf0QKDLVQc1xh4RA==/109951165973312283.jpg",
                "tns": [],
                "pic_str": "109951165973312283",
                "pic": 109951165973312290
              },
              "dt": 247275,
              "h": {
                "br": 320000,
                "fid": 0,
                "size": 9891048,
                "vd": -78026
              },
              "m": {
                "br": 192000,
                "fid": 0,
                "size": 5934646,
                "vd": -75683
              },
              "l": {
                "br": 128000,
                "fid": 0,
                "size": 3956445,
                "vd": -74828
              },
              "a": null,
              "cd": "1",
              "no": 4,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 1,
              "s_id": 0,
              "mst": 9,
              "cp": 7001,
              "mv": 0,
              "rtype": 0,
              "rurl": null,
              "publishTime": 1453996800000,
              "privilege": {
                "id": 401382522,
                "fee": 8,
                "payed": 0,
                "st": 0,
                "pl": 128000,
                "dl": 0,
                "sp": 7,
                "cp": 1,
                "subp": 1,
                "cs": false,
                "maxbr": 320000,
                "fl": 128000,
                "toast": false,
                "flag": 4,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "70ADED88EFE262E8A402E1D95316438B",
          "durationms": 204075,
          "playTime": 21521,
          "praisedCount": 65,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_ACCEF44ADD6EFC03968616D0747F0C8E",
          "coverUrl": "https://p2.music.126.net/K6osvD-0GhSpbQp5TXhaTw==/109951163211368289.jpg",
          "height": 676,
          "width": 540,
          "title": "高手在民间！这样的Purple Lamborghini你恐怕没听过！",
          "description": "高手在民间！这样的Purple Lamborghini你恐怕没听过！",
          "commentCount": 22,
          "shareCount": 32,
          "resolutions": [
            {
              "resolution": 240,
              "size": 1709203
            },
            {
              "resolution": 480,
              "size": 2447935
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 530000,
            "authStatus": 1,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/ndRwt3CJcRnkeN3ox2km6w==/109951162982454554.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 530100,
            "birthday": 659635200000,
            "userId": 63362967,
            "userType": 4,
            "nickname": "DJ-ZEN",
            "signature": "ZEN° 曾就读作曲与作曲技术理论专业.在诺地卡艺术中心多次举办个人音乐会, 2014草莓音乐节电子舞台,KENZO. GIVENCHY时装发布SHOW DJ, 2016 风暴电子音乐节上海站主舞台,2017 INTRO电子音乐节，2018东海音乐节，2019荷兰 Amsterdam Dance Event（ADE),2017 PYRO百大NO.15 ，2018 PYRO百大NO.10，2019 PYRO百大 NO.13",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951162982454560,
            "backgroundImgId": 109951163862915060,
            "backgroundUrl": "http://p1.music.126.net/szDCmUNSHANr0qj6-oQoxA==/109951163862915057.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": {
              "1": "音乐视频达人"
            },
            "djStatus": 10,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951162982454554",
            "backgroundImgIdStr": "109951163862915057"
          },
          "urlInfo": {
            "id": "ACCEF44ADD6EFC03968616D0747F0C8E",
            "url": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/wqabq2eo_1325032790_hd.mp4?ts=1628935557&rid=D67FB5953E5A5B21595C5F89FE5AF163&rl=3&rs=RokBdDGlnooDDWGtEOSSSomDMgqrKNHt&sign=5b9cac733059f48e548500ca6ba53645&ext=hKu0ESUsHZMwowQ2cE6wC1HMK6%2FNRPyYs%2FAQpiiyzfdSoYYtV2jo%2BDDzWrxmA9xIvfX%2F5xTtldF5f4My1pm3uydmglHHjAFXj5V9UOegGrFBnSGi%2Bfq6mmrWQ%2Fz86vpo6oxIP9sobLaHvxZvCQNqqR%2FM0MhjkSS8vXXRdnlrc%2Fstn%2F1UogOysDoSF4ZVRtdGnhuUu1lQCLhHCKGI7J7a4rOFcvZ8HLM3h160nSrkLhi%2BaZ1TlRoX1MMF2vWzhb7B",
            "size": 2447935,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 480
          },
          "videoGroup": [
            {
              "id": 9104,
              "name": "电子",
              "alg": null
            },
            {
              "id": 4104,
              "name": "电音",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 16119,
              "name": "搞笑短片",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": [
            109
          ],
          "relateSong": [
            {
              "name": "Purple Lamborghini",
              "id": 422094553,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 43755,
                  "name": "Skrillex",
                  "tns": [],
                  "alias": []
                },
                {
                  "id": 41989,
                  "name": "Rick Ross",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 95,
              "st": 0,
              "rt": null,
              "fee": 1,
              "v": 23,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 34780831,
                "name": "Purple Lamborghini",
                "picUrl": "http://p4.music.126.net/nIoyZxiQK3biv-Ge8DHGFQ==/109951163331924877.jpg",
                "tns": [],
                "pic_str": "109951163331924877",
                "pic": 109951163331924880
              },
              "dt": 215536,
              "h": {
                "br": 320000,
                "fid": 0,
                "size": 8622542,
                "vd": -38500
              },
              "m": {
                "br": 192000,
                "fid": 0,
                "size": 5173542,
                "vd": -36100
              },
              "l": {
                "br": 128000,
                "fid": 0,
                "size": 3449043,
                "vd": -34700
              },
              "a": null,
              "cd": "1",
              "no": 1,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 0,
              "s_id": 0,
              "mst": 9,
              "cp": 7002,
              "mv": 5351048,
              "rtype": 0,
              "rurl": null,
              "publishTime": 1469145600000,
              "privilege": {
                "id": 422094553,
                "fee": 1,
                "payed": 0,
                "st": 0,
                "pl": 0,
                "dl": 0,
                "sp": 0,
                "cp": 0,
                "subp": 0,
                "cs": false,
                "maxbr": 320000,
                "fl": 0,
                "toast": false,
                "flag": 260,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "ACCEF44ADD6EFC03968616D0747F0C8E",
          "durationms": 14049,
          "playTime": 22633,
          "praisedCount": 80,
          "praised": false,
          "subscribed": false
        }
      }];
    let videoList = this.data.videoList;
    // 将视频最新数据更新到原有的视频列表数据中
    videoList.push(...newVideoList);
    this.setData({
      videoList
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   * 注意：只有定义了此事件处理函数，右上角菜单才会显示“转发”按钮
   */
  onShareAppMessage: function () {

  }
})
